x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 27 Oct 2008 10:49:20 +0000 (10:49 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 27 Oct 2008 10:49:20 +0000 (10:49 +0000)
hence must *always* disable IRQs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/x86_32/domain_page.c

index 10f807b3e3abc18bcab5e7e2343ab563401aa659..2fe2e562c44f84018e125a6d02a70d58daeee2b4 100644 (file)
@@ -43,7 +43,7 @@ static inline struct vcpu *mapcache_current_vcpu(void)
 void *map_domain_page(unsigned long mfn)
 {
     unsigned long va;
-    unsigned int idx, i;
+    unsigned int idx, i, flags;
     struct vcpu *v;
     struct mapcache_domain *dcache;
     struct mapcache_vcpu *vcache;
@@ -69,7 +69,7 @@ void *map_domain_page(unsigned long mfn)
         goto out;
     }
 
-    spin_lock(&dcache->lock);
+    spin_lock_irqsave(&dcache->lock, flags);
 
     /* Has some other CPU caused a wrap? We must flush if so. */
     if ( unlikely(dcache->epoch != vcache->shadow_epoch) )
@@ -105,7 +105,7 @@ void *map_domain_page(unsigned long mfn)
     set_bit(idx, dcache->inuse);
     dcache->cursor = idx + 1;
 
-    spin_unlock(&dcache->lock);
+    spin_unlock_irqrestore(&dcache->lock, flags);
 
     l1e_write(&dcache->l1tab[idx], l1e_from_pfn(mfn, __PAGE_HYPERVISOR));